#
# def plus(n):
#     return n+1
#
# plus2 = lambda x:x+1
#
# # def plus2(n):
# #     return n+1

account = {
    "is_authenticated":False, # 是否授权
    "username":"alex", # DB中包含
    "password":"abc"  # DB中包含
}

def login(func):

    # user = input("请输入用户名:")
    # password = input("请输入密码:")

    def inner():
        if account["is_authenticated"] == False:
            username = input("User:")
            password = input("Password:")

            if account["username"] == username and account["password"] == password :
                print("Welcome login!")
                account["is_authenticated"] = True
                func()
            else:
                print("Wrong username or password.")

        else :
            print("用户已登录，验证通过。")
            func()

    return inner


def home():
    print("----首页----")

@login
def usa():
    print("----欧美专区----")

@login
def japan():
    print("----日本专区----")

@login
def henan():
    print("----河南专区----")

home()

usa()

japan()

henan()


